﻿@{
    ViewBag.Title = "Control Panel";
    }


<script src="/Scripts/MiscCommands.js"></script>

<br />
<br />
    
        
     
      
       


<h3><i>Primary Investigator Control Panel</i></h3>
<h2 style="text-align:center">Your Requests</h2>
<table>
    <thead>
        <tr>
            <td>Request No.</td>
            <td>Request Type</td>
            <td>Associated Project</td>
            <td>Size Requested</td>
            <td>Approved?</td>
            <td>Actioned?</td>
            <td>Date Created</td>
            <td>Date Approved</td>
            <td>Date Actioned</td>
            <td>Comments</td>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in ViewBag.ListOfReqs)
        {
            <tr>
                <td>@item.RequestID</td>
                <td>@item.tblRequestType.strRequestName</td>
                <td>
                    @{
            if (item.ProjectID != null)
            {
                ViewBag.AssocProj = item.Projects.strProjectName;
            }
            else
            {
                ViewBag.AssocProj = "None";
            }
                    }
                    @ViewBag.AssocProj
                </td>
                <td>@item.intRequestSize GB</td>
                <td>
                    @{
            if (item.dtmApproved != null)
            {
                ViewBag.Approval = "yes";
            }
            else
            {
                ViewBag.Approval = "no";
            }
                }@ViewBag.Approval
            </td>
            <td>
                @{
            if (item.dtmCompleted != null)
            {
                ViewBag.Actioned = "yes";
            }
            else
            {
                ViewBag.Actioned = "no";
            }
            }@ViewBag.Actioned
        </td>
        <td>@item.dtmCreated.ToString()</td>
        <td>
            @{
            if (item.dtmApproved != null)
            {
                ViewBag.dtmApproved = item.dtmApproved.ToString();
            }
            else
            {
                ViewBag.dtmApproved = "Not Approved";
            }
        }@ViewBag.dtmApproved
    </td>
    <td>
        @{
            if (item.dtmCompleted != null)
            {
                ViewBag.dtmCompleted = item.dtmCompleted.ToString();
            }
            else
            {
                ViewBag.dtmCompleted = "Not Approved";
            }
    }@ViewBag.dtmCompleted
</td>


                <td>
                    <div id="ModifyComment">
                        <form action="/ControlPanel/ModifyCommentPrimInv" method="post">
                            <table align="center">
                                <tr>
                                    <td>
                                        <input name="theComment" type="text" style="width:100px" value="@item.Comments"> <input type="submit" value="Modify Comment" />
                                        <input name="theReq" type="hidden" value="@item.RequestID" />
                                    <td>
                                </tr>
                            </table>
                        </form>
                    </div> 
                </td>





</tr>
        }

    </tbody>

</table>

<br /><br /><br />
<div id="openMyProjs" style="text-align:left">
    <form action="/MyProjects/Index" method="post">
        <input type="submit" value="View Projects" />
    </form>
</div>
<div id="actionbuttons" style="text-align:left">
    <button onclick="AddReq()">Add a new request</button>

    
    
</div>

    <div id="newStorage" style="display:none">
        <h3><i>Create New Request</i></h3>
        @{
            //button so people can get rich in data
            var listOfStuff = ViewBag.listOfStuff;
            var myUser = ViewBag.UserInfo;
        }
    <form action="/ControlPanel/NewRequestData" name="newRequestData" onsubmit="return validateSizeForm()" method="post">
        <table>
            <tr>
                <td>Request Type:</td>
                <td>
                    <select name="requestType">
                        @foreach (var item in ViewBag.madHacks)
                        {
                            <option value="@item.RequestTypeID"> @item.strRequestName </option>
                        }
                    </select>
                </td>
            </tr>
            <tr>
                <td>Project:</td>
                <td>
                    <select name="projectID">
                        <option value="-1">None</option>
                        @foreach (var item in ViewBag.ProjectsIOwn)
                        {
                            <option value="item.ProjectID">@item.strProjectName </option>
                        }
                    </select>
                </td>
            </tr>
            <tr>
                <td>Request Size(GB):</td>
                <td><input name="storageSize" type="text" /></td>
            </tr>
            <tr>
                 <td>Comment:</td><td><input name="theComment" type="text" value=""></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="Submit New Request"></td>
            </tr>

        </table>
                <br><br />
    </form>
    </div>


    